<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>满意度测评系统后台</title>
  <link rel="shortcut icon" href="/static/images/favicon.ico"/>
  #include('../cdn/cdn.html')
  <script src="/static/style/admin/js/honeySwitch.js"></script>

  <link rel="stylesheet" href="/static/style/admin/css/header.css">
  <link rel="stylesheet" href="/static/style/admin/css/admin.css">
  <link rel="stylesheet" href="/static/style/css/all-style.css">
  <link rel="stylesheet" href="/static/style/css/flex.css">
  <link rel="stylesheet" href="/static/style/admin/css/honeySwitch.css">
  <script>
    $(document).ajaxStart(function () {
      $('#loading').removeClass('hidden')
    }).ajaxStop(function () {
      $('#loading').addClass('hidden')
    })
  </script>
</head>
<body>
<header class="header">
  <div class="h-logo">
    <span class="fa fa-navicon"></span>
    <span>满意度测评系统后台</span>
  </div>
  <div class="pull-right">
    <a id="logout" href="javascript:" class="btn btn-xs btn-danger">
      <span class="fa fa-sign-out"></span> 注销
    </a>
  </div>
</header>

<aside class="side">
  <div>
    <a href="/admin"><img class="img-circle" src="/static/images/logo.png" width="60"></a>
    <h5><b>欢迎: ${admin.name ?! '管理员'}</b></h5>
  </div>
  <ul id="aside-menu">
    <li>
      <a href="/admin"><span class="fa fa-dashboard"></span> 仪表盘</a>
    </li>
    <li>
      <a href="/admin/mark"><span class="fa fa-hand-o-down"></span> 扫码打分</a>
    </li>
    <li>
      <a href="/admin/shops"><span class="fa fa-book"></span> 线上公司</a>
    </li>
    <li>
      <a href="/admin/stage"><span class="fa fa-bar-chart"></span>打分阶段</a>
    </li>
    <li class="menu">
      <a href="javascript:"><span class="fa fa-file-text-o"></span> 记录管理
        <span class="caret"></span></a>
      <ul class="hide-opt">
        <li><a href="/admin/count">阶段记录</a></li>
        <li><a href="/admin/record">评分记录</a></li>
        <li><a href="/admin/history">历史阶段记录</a></li>
      </ul>
    </li>
    <li>
      <a href="/admin/users"><span class="fa fa-male"></span>&nbsp;&nbsp;用户管理</a>
    </li>
    #if(admin.grade > 1)
    <li class="menu">
      <a href="javascript:"><span class="fa fa-cog"></span> 系统管理
        <span class="caret"></span></a>
      <ul class="hide-opt">
        <li><a href="/admin/list">管理员信息</a></li>
        <li><a href="/admin/setting">个人设置</a></li>
        <li><a href="/admin/scoresetting">分值设置</a></li>
      </ul>
    </li>
    #else
    <li>
      <a href="/admin/setting"><span class="fa fa-cog"></span> 个人设置</a>
    </li>
    #end
  </ul>
</aside>

<script type="text/javascript">
  // 通过jquery实现简洁的手风琴菜单
  $('#aside-menu .menu > a').on('click', function (event) {
    $(this).parent('li').siblings('li#menu').children('ul').hide(300) // 隐藏其他的菜单
    $(this).parent('li').children('ul').toggle(300) // 显示当前菜单
  })

  function changeTab(text) {
    // 通过a标签中内容改变菜单栏的激活
    $('.side li.active').removeClass('active') // 将其他菜单去除激活
    $('.side li > a').each(function (index, el) {
      if (el.innerText.indexOf(text) != -1) {
        $(el).parent('li').addClass('active').parent('ul').removeClass('hide-opt')
        return false
      }
    })
  }

  $('#logout').on('click', function (e) {
    $.post('/admin/logout', function (data) {
      if (data.success) {
        alert('注销成功！')
        location.href = '/admin/login'
      }
    })
  })
</script>
